﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using RestSharp;
using WeiTalk.SinaEntities.Comment;
using WeiTalk.OAuth;

namespace WeiTalk.Interfaces.Sina
{
    /// <summary>
    /// 评论API
    /// </summary>
    public class CommentAPI:WeiBoAPIs
    {
        const string commentsShowUrl = "https://api.weibo.com/2/comments/show.json";

        public CommentAPI(RestClient client) : base(client) { }

        public void CommentShow(Action<IRestResponse<Collection>> callback, string id, int page = 1, string since_id = "0", int max_id = 0, int filter_by_author = 0)
        {
            RestRequest request = new RestRequest(commentsShowUrl, Method.GET);
            request.AddParameter("source", Utility.ConsumerKey);
            request.AddParameter("access_token", Utility.AccessToken.Token);
            request.AddParameter("count", Constant.WeiBoCount);
            request.AddParameter("id", id);
            request.AddParameter("page", page);
            request.AddParameter("since_id", since_id);
            request.AddParameter("max_id", max_id);
            request.AddParameter("timestamp", Guid.NewGuid().ToString());
            Client.ExecuteAsync<Collection>(request, callback);
        }
    }
}
